//
//  LRXThingRamaindView.m
//  路人侠
//
//  Created by zhangxulong on 4/8/16.
//  Copyright © 2016 zhangxulong. All rights reserved.
//

#import "LRXThingRemaindView.h"

@implementation LRXThingRemaindView

- (void)thingRemaindView
{
    //开始的时候隐藏
    
    self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6];
    
    UIImageView * shopRemindImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"shopRemind"]];
    shopRemindImage.frame = CGRectMake(50 * wScale, 20 * hScale, 40 * wScale, 50 * hScale);
    
    [self addSubview:shopRemindImage];
    
    UILabel * thingRemindLabel = [[UILabel alloc]init];
    thingRemindLabel.backgroundColor = [UIColor redColor];
    thingRemindLabel.text = @"0";
    thingRemindLabel.textColor = [UIColor whiteColor];
    thingRemindLabel.textAlignment = NSTextAlignmentCenter;
    thingRemindLabel.font = [UIFont systemFontOfSize:15 * hScale];
    thingRemindLabel.center = CGPointMake(CGRectGetMaxX(shopRemindImage.frame) - 5 * wScale, CGRectGetMinY(shopRemindImage.frame) - 5 * hScale);
    [thingRemindLabel sizeToFit];
    CGFloat maxH = MAX(thingRemindLabel.frame.size.height, thingRemindLabel.frame.size.width) + 5 * hScale;
    thingRemindLabel.bounds = CGRectMake(0, 0, maxH, maxH);
    thingRemindLabel.layer.cornerRadius = maxH  * 0.5;
    self.thingRemindLabel = thingRemindLabel;
    self.thingRemindLabel.layer.masksToBounds = YES;
    
    
    [self addSubview:thingRemindLabel];
    
    UILabel * thingRemindMoney = [[UILabel alloc]init];
    thingRemindMoney.text = @"共0.00元";
    thingRemindMoney.textAlignment = NSTextAlignmentLeft;
    thingRemindMoney.textColor = [UIColor whiteColor];
    thingRemindMoney.font = [UIFont systemFontOfSize:35 * hScale];
    thingRemindMoney.frame = CGRectMake(CGRectGetMaxX(shopRemindImage.frame) + 40 * wScale, 0, 200 * wScale, 100 * hScale);
    self.thingRemindMoney = thingRemindMoney;
    [self addSubview:thingRemindMoney];
    
    
    UIButton * accpBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    accpBtn.backgroundColor = orangeColor;
    accpBtn.frame = CGRectMake(self.frame.size.width * 0.7, 0, self.frame.size.width * 0.3, 100 * hScale);
    [accpBtn setTitle:@"确定" forState:UIControlStateNormal];
    accpBtn.titleLabel.font = [UIFont systemFontOfSize:30 * hScale];
    [accpBtn addTarget:self action:@selector(accpetClick) forControlEvents:UIControlEventTouchUpInside];
    
    [self addSubview:accpBtn];
}
- (void)accpetClick
{
    
    if ([self.thingRemaindDelegate respondsToSelector:@selector(accpetBtnClick)]) {
        [self.thingRemaindDelegate accpetBtnClick];
    }
}

@end
